home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2006 May
/
PCWMAY06.iso
/
Software
/
Freeware
/
First Page 2006 3.00
/
fp2006-final-3.00-setup.exe
/
{app}
/
Iscripts
/
Cookie
/
name-visits-message.izs
< prev
next >
Wrap
Text File
|
2005-09-28
|
7KB
|
236 lines
<!NOWIZARD>
<!TITLE>Name - Visits - Message
<!/TITLE>
<!DESCRIPTION>This script stores the amount of times you visit the page and displays a nice message showing you.<!/DESCRIPTION>
<!CATEGORY>cookies<!/CATEGORY>
<!SCRIPT>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL COOKIE: NAME - VISITS - LAST VISIT:
1. Put the designated script into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Copy the last script into the BODY of your HTML document -->
<!-- STEP ONE: Copy this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Bill Dortch, hIdaho Design (bdortch@netw.com)
<!-- Begin
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DisplayInfo() {
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", null, false);
var message;
if(visit == 1)
message=" Welcome to my page!";
if(visit== 2)
message=" I see you came back !";
if(visit == 3)
message=" Oh, it's you again!";
if(visit == 4)
message=" You must be curious!";
if(visit == 5)
message=" You're practically a regular!";
if(visit == 6)
message=" You need a hobby!";
if(visit == 7)
message=" Nothing better to do?";
if(visit == 8)
message=" Don't you ever sleep?";
if(visit == 9)
message=" Get a life!!!";
if(visit >= 10)
message=" Rent is due on the 1st of the month!";
alert("\n"+"Your browser has visited this page \n"
+" "+visit+"\n"
+" time(s)."+"\n"+"\n"
+message);
}
function ResetCounts() {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
visit = 0;
SetCookie("visit", visit, expdate , "/", null, false);
history.go(0);
}
// End -->
</Script>
<!-- STEP TWO: Add the onLoad event handler into the BODY tag -->
<BODY onload="DisplayInfo()">
<!-- STEP THREE: Copy code into BODY section of document -->
<FORM>
<CENTER>
<INPUT NAME="update" TYPE="BUTTON" VALUE="Revisit Page" OnClick="history.go(0)">
<INPUT NAME="reset" TYPE="BUTTON" VALUE="Reset Counter" OnClick="ResetCounts()">
</CENTER>
</FORM>
<!-- END OF SCRIPT -->
<!/SCRIPT>
<!PREVIEW>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL COOKIE: NAME - VISITS - LAST VISIT:
1. Put the designated script into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Copy the last script into the BODY of your HTML document -->
<!-- STEP ONE: Copy this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Bill Dortch, hIdaho Design (bdortch@netw.com)
<!-- Begin
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DisplayInfo() {
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", null, false);
var message;
if(visit == 1)
message=" Welcome to my page!";
if(visit== 2)
message=" I see you came back !";
if(visit == 3)
message=" Oh, it's you again!";
if(visit == 4)
message=" You must be curious!";
if(visit == 5)
message=" You're practically a regular!";
if(visit == 6)
message=" You need a hobby!";
if(visit == 7)
message=" Nothing better to do?";
if(visit == 8)
message=" Don't you ever sleep?";
if(visit == 9)
message=" Get a life!!!";
if(visit >= 10)
message=" Rent is due on the 1st of the month!";
alert("\n"+"Your browser has visited this page \n"
+" "+visit+"\n"
+" time(s)."+"\n"+"\n"
+message);
}
function ResetCounts() {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
visit = 0;
SetCookie("visit", visit, expdate , "/", null, false);
history.go(0);
}
// End -->
</Script>
<!-- STEP TWO: Add the onLoad event handler into the BODY tag -->
<BODY onload="DisplayInfo()">
<!-- STEP THREE: Copy code into BODY section of document -->
<FORM>
<CENTER>
<INPUT NAME="update" TYPE="BUTTON" VALUE="Revisit Page" OnClick="history.go(0)">
<INPUT NAME="reset" TYPE="BUTTON" VALUE="Reset Counter" OnClick="ResetCounts()">
</CENTER>
</FORM>
<!-- END OF SCRIPT -->
<!/PREVIEW>
<!RELATED>NONE<!/RELATED>